﻿using Microsoft.EntityFrameworkCore.Metadata.Internal;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LowCoding.Dto
{
    public class AppModuleDto
    {
        /// <summary>
        /// 根节点Code
        /// </summary>
        public static string RootModuleCode = "-1";

        /// <summary>
        /// 根节点Id
        /// </summary>
        public static int RootModuleId = -999;

        /// <summary>
        /// 模块id
        /// </summary>
        [SugarColumn(ColumnName = "ID")]
        public string Id { get; set; }

        /// <summary>
        /// 模块功能代码
        /// </summary>
        [SugarColumn(ColumnName = "AME_CODE")]
        public string ModuleCode { get; set; }

        /// <summary>
        /// 模块功能名称
        /// </summary>
        [SugarColumn(ColumnName = "AME_NAME")]
        public string ModuleName { get; set; }

        private string _moduleType = "M";

        /// <summary>
        /// 类型
        /// </summary>
        [SugarColumn(ColumnName = "AME_TYPE")]
        public string ModuleType
        {
            get { return _moduleType; }
            set { _moduleType = value; }
        }

        /// <summary>
        /// 父模块功能
        [SugarColumn(ColumnName = "AME_PARENT")]
        public string ParentModuleCode { get; set; }

        /// <summary>
        /// 菜单连接地址
        /// </summary>
        [SugarColumn(ColumnName = "AME_URL")]
        public string ModuleUrl { get; set; }

        public string path { get; set; }

        /// <summary>
        /// 序号
        /// </summary>
        [SugarColumn(ColumnName = "SORTNO")]
        public int? ModuleSeq { get; set; }

        /// <summary>
        /// 按钮图标样式
        /// </summary>
        [SugarColumn(ColumnName = "AME_ICONCLS")]
        public string IconCls { get; set; }

        private string _valid = "1";

        /// <summary>
        /// 是否可用
        /// </summary>
        [SugarColumn(ColumnName = "AME_VALID")]
        public string Valid
        {
            get { return _valid; }
            set { _valid = value; }
        }

        public bool bValid
        {
            get { return Valid == "0"; }
            set
            {
                if (value) Valid = "0";
                else
                    Valid = "1";
            }
        }

        /// <summary>
        /// 菜单等级
        /// </summary>
        [SugarColumn(ColumnName = "AME_LEVEL")]
        public int? ModuleLevel { get; set; }

        /// <summary>
        /// 模块图标
        /// </summary>
        [SugarColumn(ColumnName = "AME_IMG_SRC")]
        public int? ModuleSrc { get; set; }

        /// <summary>
        /// 模块选中图标
        /// </summary>
        [SugarColumn(ColumnName = "AME_IMG_SRC_SELECTED")]
        public int? ModuleSelected { get; set; }

        /// <summary>
        /// 是否有权限
        /// </summary>
        public bool HasRights { get; set; }

        /// <summary>
        /// 第几级菜单
        /// </summary>

        public string MDL_LEVEL { get; set; }

        /// <summary>
        /// 父级是第几级菜单
        /// </summary>
        public string MDL_PARENTLEVEL { get; set; }
    }
}
